<?php

namespace App\Listeners\Prize;

use App\Events\VoucherCodeImported;
use App\Morefun\Prize\VoucherCodeSynchronizer;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class WriteVoucherCodeToRedis
{
    protected $synchronizer;
    public function __construct(VoucherCodeSynchronizer $synchronizer)
    {
        $this->synchronizer = $synchronizer;
    }

    /**
     * Handle the event.
     *
     * @param  VoucherCodeImported  $event
     * @return void
     */
    public function handle(VoucherCodeImported $event)
    {
        $this->synchronizer->write($event->getPrizeId());
    }
}
